/*
 * simulation.cpp
 *
 *  Created on: Oct 3, 2012
 *      Author: hammer
 */

#define PI 3.14159265
#include <iostream>
#include <sstream>
#include <string>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
#include <vector>

using namespace std;

#include "matrices.h"
#include "RNG.h"
#include "polymer.h"
#include "hash.h"
#include "polymer_list.h"


int main() {
  int N0=9;
  int D=2;
  int level=6;
  int N=pow(2,level)*(N0-1)+1;
  int N_list=10000;
  int N_pivots=10000;
  float step_size=1;
  float sphere_size=0.4999;
  int i;
  int count=0;
  Dim_log_line log[level];
  Hash_table table1(N,D);
  Polymer poly1,poly2,poly3;
  Polymer_list list1(N_list,N0,D,sphere_size);
  ofstream out_file;
  out_file.open("output.txt");
  ofstream log_file;
  log_file.open("dimerization_log.txt");
  ifstream in_file;
  in_file.open("list2d.txt");
  ran2(&idum);
  vector<float> pos;
  pos.resize(D,0);
  list1.read_list(in_file);
  poly1=list1.dimerization(level,log);
  //list1.make_list(out_file);
  //list1.read_list(in_file);
  //for (i=0;i<N;i++) {
	//  pos[D-1]=i;
	//  poly1.add_monomer(pos);
  //}
  //poly1.print(out_file);
  //for (i=0;i<N_pivots;i++) {
	//  count=count+poly1.pivot(sphere_size);
  //}
  //cout << "successful pivot: " << count << "/" << N_pivots << "\n";
  poly1.print(out_file);
  for (i=0;i<level;i++) {
	  log[i].print(log_file);
  }
  cout << "\ndone\n";
  out_file.close();
  log_file.close();
  in_file.close();
  return 1;
}
